package com.mark.spring.annotation.register.imports.register;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

/**
 * @Description: 自定义Bean注册
 * @Author: Mark
 * @CreateDate: 2019/9/22 11:30
 * @Version: 3.00.001
 * @Copyright : 豆浆油条个人非正式工作室
 */
public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {

    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        BeanDefinition beanDefinition = new RootBeanDefinition(Registrar.class);
        registry.registerBeanDefinition("registrar",beanDefinition);
    }
}
